<template>
	<view class="ServingCell size-30 por">
		<view class="serving-img poa" @click="onPreviewImage(item.communityImage || item.img)">
			<image class="width-height100" :src="item.communityImage || item.img" mode=""></image>
			<view class="serving poa dis color-f">查看图片</view>
		</view>
		<view class="cell" @click="onOpenLocation(item)">
			<view class="width100 dis-ali">
				<text class="color9">小区名称</text>{{item.communityName || ''}}
				<text class="iconfont icon-dingwei size-30 margin-left-12"></text>
			</view>
			<view class="width100 flex">
				<text class="color9">团长信息</text>
				<text v-if="!item.realName && !item.groupName && !item.manageUserName" class="color">暂无团长入驻</text>
				<view v-else>
					<text v-if="item.realName">{{item.realName}}</text>
					<text v-else-if="item.groupName">{{item.groupName}}</text>
					<text v-else-if="item.manageUserName">{{item.manageUserName}}</text>
					<text>({{item.sex*1 ? '先生' : '女士'}})</text>
					<text v-if="item.telephone">{{item.telephone}}</text>
					<text v-else-if="item.phoneNumber">{{item.phoneNumber}}</text>
					<text v-else-if="item.manageUserPhone">{{item.manageUserPhone}}</text>
				</view>
			</view>
			<view class="dis-ali width100">
				<text class="color9">详情地址</text>
				<view class="cell-adds box ">{{item.communityAddress || ''}}{{item.communityHouseNumber ||''}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {

			}
		},
		methods: {
			onPreviewImage(img) {
				this.$emit('previewImage', img)
			},
			onOpenLocation(item) {
				uni.openLocation({
					name: item.communityName,
					address: `${item.communityAddress}${item.communityHouseNumber}`,
					latitude: item.communityLatitude,
					longitude: item.communityLongitude,
					success: function() {
						console.log('success');
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.ServingCell {

		// margin-top: 28rpx;
		.serving-img {
			width: 120rpx;
			height: 120rpx;
			right: 0;
			top: 0;
			border-radius: 16rpx;
			overflow: hidden;
		}

		.serving {
			width: 100%;
			height: 30rpx;
			background: rgba(0, 0, 0, 0.3);
			bottom: 0;
			left: 0;
			font-size: 20rpx;
		}

		.cell-adds {
			width: 78%;
		}

		.cell {
			display: grid;
			grid-gap: 30rpx;
		}

		.color9 {
			margin-right: 24rpx;
		}
	}
</style>